.class public Lrexsee/core/browser/clazz/History;
.super Ljava/lang/Object;
.source "History.java"


# instance fields
.field private mCurrentIndex:I

.field private final mList:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lrexsee/core/browser/clazz/HistoryItem;",
            ">;"
        }
    .end annotation
.end field

.field private mTotalPages:I


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 5
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 7
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    .line 8
    const/4 v0, -0x1

    iput v0, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    .line 9
    const/4 v0, 0x0

    iput v0, p0, Lrexsee/core/browser/clazz/History;->mTotalPages:I

    .line 5
    return-void
.end method


# virtual methods
.method public add(Ljava/lang/String;)V
    .locals 4
    .param p1, "historyItem"    # Ljava/lang/String;

    .prologue
    const/4 v3, 0x1

    .line 12
    iget v1, p0, Lrexsee/core/browser/clazz/History;->mTotalPages:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Lrexsee/core/browser/clazz/History;->mTotalPages:I

    .line 13
    iget-object v1, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    if-nez v1, :cond_1

    .line 14
    iget-object v1, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    new-instance v2, Lrexsee/core/browser/clazz/HistoryItem;

    invoke-direct {v2, p1}, Lrexsee/core/browser/clazz/HistoryItem;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 15
    const/4 v1, 0x0

    iput v1, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    .line 26
    :cond_0
    :goto_0
    return-void

    .line 18
    :cond_1
    iget-object v1, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    iget v2, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lrexsee/core/browser/clazz/HistoryItem;

    invoke-virtual {v1}, Lrexsee/core/browser/clazz/HistoryItem;->getUrl()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/String;->compareTo(Ljava/lang/String;)I

    move-result v1

    if-eqz v1, :cond_0

    .line 19
    iget v1, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    iget-object v2, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    sub-int/2addr v2, v3

    if-eq v1, v2, :cond_2

    .line 20
    iget-object v1, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    sub-int v0, v1, v3

    .local v0, "i":I
    :goto_1
    iget v1, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    if-gt v0, v1, :cond_3

    .line 24
    .end local v0    # "i":I
    :cond_2
    iget-object v1, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    new-instance v2, Lrexsee/core/browser/clazz/HistoryItem;

    invoke-direct {v2, p1}, Lrexsee/core/browser/clazz/HistoryItem;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 25
    iget v1, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    goto :goto_0

    .line 21
    .restart local v0    # "i":I
    :cond_3
    iget-object v1, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    invoke-virtual {v1, v0}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;

    .line 20
    add-int/lit8 v0, v0, -0x1

    goto :goto_1
.end method

.method public clear()V
    .locals 2

    .prologue
    .line 56
    invoke-virtual {p0}, Lrexsee/core/browser/clazz/History;->getCurrentItem()Lrexsee/core/browser/clazz/HistoryItem;

    move-result-object v0

    .line 57
    .local v0, "item":Lrexsee/core/browser/clazz/HistoryItem;
    iget-object v1, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->clear()V

    .line 58
    iget-object v1, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    invoke-virtual {v1, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 59
    const/4 v1, 0x0

    iput v1, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    .line 60
    return-void
.end method

.method public getCurrentIndex()I
    .locals 1

    .prologue
    .line 34
    iget v0, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    return v0
.end method

.method public getCurrentItem()Lrexsee/core/browser/clazz/HistoryItem;
    .locals 2

    .prologue
    .line 44
    iget v0, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    if-gez v0, :cond_0

    const/4 v0, 0x0

    .end local p0    # "this":Lrexsee/core/browser/clazz/History;
    :goto_0
    return-object v0

    .restart local p0    # "this":Lrexsee/core/browser/clazz/History;
    :cond_0
    iget-object v0, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    iget v1, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p0

    .end local p0    # "this":Lrexsee/core/browser/clazz/History;
    check-cast p0, Lrexsee/core/browser/clazz/HistoryItem;

    move-object v0, p0

    goto :goto_0
.end method

.method public getItemAtIndex(I)Lrexsee/core/browser/clazz/HistoryItem;
    .locals 1
    .param p1, "index"    # I

    .prologue
    .line 47
    iget-object v0, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p0

    .end local p0    # "this":Lrexsee/core/browser/clazz/History;
    check-cast p0, Lrexsee/core/browser/clazz/HistoryItem;

    return-object p0
.end method

.method public getSize()I
    .locals 1

    .prologue
    .line 31
    iget-object v0, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    return v0
.end method

.method public getTotalPages()I
    .locals 1

    .prologue
    .line 28
    iget v0, p0, Lrexsee/core/browser/clazz/History;->mTotalPages:I

    return v0
.end method

.method public remove(I)V
    .locals 2
    .param p1, "index"    # I

    .prologue
    .line 51
    iget v0, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    if-ne p1, v0, :cond_1

    .line 54
    :cond_0
    :goto_0
    return-void

    .line 52
    :cond_1
    iget-object v0, p0, Lrexsee/core/browser/clazz/History;->mList:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;

    move-result-object v0

    if-eqz v0, :cond_0

    iget v0, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    if-le p1, v0, :cond_2

    iget v0, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    :goto_1
    iput v0, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    goto :goto_0

    :cond_2
    iget v0, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    const/4 v1, 0x1

    sub-int/2addr v0, v1

    goto :goto_1
.end method

.method public setCurrentIndex(I)V
    .locals 0
    .param p1, "index"    # I

    .prologue
    .line 37
    iput p1, p0, Lrexsee/core/browser/clazz/History;->mCurrentIndex:I

    .line 38
    return-void
.end method

.method public setCurrentTitle(Ljava/lang/String;)V
    .locals 1
    .param p1, "title"    # Ljava/lang/String;

    .prologue
    .line 40
    invoke-virtual {p0}, Lrexsee/core/browser/clazz/History;->getCurrentItem()Lrexsee/core/browser/clazz/HistoryItem;

    move-result-object v0

    invoke-virtual {v0, p1}, Lrexsee/core/browser/clazz/HistoryItem;->setTitle(Ljava/lang/String;)V

    .line 41
    return-void
.end method
